<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改材料规格')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-material-edit" th:object="${gysptMaterial}">
            <input name="id" th:field="*{id}" type="hidden">
            <input id="treeId" name="typeId" th:field="*{typeId}" type="hidden" />
            <div class="form-group">    
                <label class="col-sm-2 control-label is-required">物料类别：</label>
                <div class="col-sm-4">
					<div class="input-group">
						<input class="form-control" type="text" required="required" onclick="selectDeptTree()" th:field="*{typeName}" id="treeName" readonly="true" th:value="${dept?.deptName}" >
					    <span class="input-group-addon"><i class="fa fa-search"></i></span>
				    </div>
                </div>
                <label class="col-sm-2 control-label is-required">物料编号：</label>
                <div class="col-sm-4">
                    <input name="typebh" th:field="*{typebh}" class="form-control" type="text" required="required">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label is-required">物料名称：</label>
                <div class="col-sm-4">
                    <input name="mingc" th:field="*{mingc}" class="form-control" type="text" required="required">
                </div>
                <label class="col-sm-2 control-label is-required">物料品牌：</label>
                <div class="col-sm-4">
                    <input name="clpp" th:field="*{clpp}" class="form-control" type="text" required="required">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label is-required">规格型号：</label>
                <div class="col-sm-4">
                    <input name="guig" th:field="*{guig}" class="form-control" type="text" required="required">
                </div>
                <label class="col-sm-2 control-label">单位：</label>
                <div class="col-sm-4">
                	<select name="danw" class="form-control" th:field="*{danw}" th:with="type=${@dict.getType('gys_until')}" >
		                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
		            </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label is-required">系统指导价（不含税）：</label>
                <div class="col-sm-4">
                    <input name="zdjine" th:field="*{zdjine}" class="form-control" type="text" required="required">
                </div>
                <label class="col-sm-2 control-label is-required">是否服务：</label>
                <div class="col-sm-4">
				    <div class="radio-box" th:each="dict : ${@dict.getType('sys_yes_no')}">
						<input type="radio" th:id="${dict.dictCode}" th:field="*{leixing}" name="leixing" th:value="${dict.dictValue}" >
						<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
					</div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">备注：</label>
                <div class="col-sm-10">
                    <textarea name="memo" class="form-control">[[*{memo}]]</textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "gcgl/material";
        $("#form-material-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-material-edit').serialize());
            }
        }
        
        /*部门管理-新增-选择父部门树*/
		function selectDeptTree() {
			var treeId = $("#treeId").val();
			if ($.common.isEmpty(treeId)) {
				treeId = 0;
       		}
			var options = {
				title: '类型选择',
				width: "380",
				url: ctx + "gcgl/type/selectTypeTree/" + treeId,
				callBack: doSubmit
			};
			$.modal.openOptions(options);
		}
		
		function doSubmit(index, layero){
			var body = $.modal.getChildFrame(index);
   			$("#treeId").val(body.find('#treeId').val());
   			$("#treeName").val(body.find('#treeName').val());
   			$.modal.close(index);
		}

    </script>
</body>
</html>